home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 5_8.lha / 5_8 / 5_8tst.c < prev    next >
Text File  |  1993-08-08  |  714b  |  33 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. include <stream.h>
  6. include "5_8a5.h"    // class randint
  7. include "5_8b1.h"    // class urand, erand
  8. include "5_8b2.c"    // urand::draw()
  9. include "5_8b3.c"    // erand::draw()
  10.  
  11. ain()
  12.  
  13.    randint r(1);
  14.    for (int i = 0; i++ < 20; )
  15. cout << "draw(): " << r.draw() << "\n";
  16.  
  17.    r.seed(1);
  18.    for (i = 0; i++ < 20; )
  19. cout << "fdraw(): " << r.fdraw() << "\n";
  20.  
  21.    urand ur(15, 65);
  22.    ur.seed(1);
  23.    for (i = 0; i++ < 20; )
  24. cout << "ur.draw(): " << ur.draw() << "\n";
  25.  
  26.    erand er(50);
  27.    er.seed(1);
  28.    for (i = 0; i++ < 20; )
  29. cout << "er.draw(): " << ur.draw() << "\n";
  30.  
  31.    return 0;
  32.  
  33.